package soundwave.com.demo.activity;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;

import soundwave.com.demo.R;

/**
 * Created by xu on 2017/4/2.
 */

public class Modify_name extends Activity {
    private EditText newname;
    private Button ok;
    private String name_new;
    private TextView back;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.modify_name);
        initView();
        ok.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                name_new = newname.getText().toString();
                if (name_new.equals("")) {
                    Toast.makeText(Modify_name.this, "新昵称不能为空！", Toast.LENGTH_SHORT).show();
                } else {
                    finish();
                }
            }
        });
        back.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                finish();
            }
        });


    }

    private void initView() {
        newname = (EditText) findViewById(R.id.newname);
        ok = (Button) findViewById(R.id.ok);

        back = (TextView) findViewById(R.id.back);

    }


}
